<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
    <script>
      Array.prototype.myFill = function (value , start = 0,end = this.length){
        for (let i = start; i < end; i++) {
          this[i] = value;
        }
      }
      //array.filter(function(currentValue,index,arr), thisValue)
  Array.prototype.myFilter = function myFilter(fn, context) {
      if (typeof fn !== "function") {
          throw new TypeError(`${fn} is not a function`);
      }
      let arr = this;
      let temp = [];
      for (let i = 0; i < arr.length; i++) {
          let result = fn.call(context, arr[i], i, arr);
          if (result) temp.push(arr[i]);
      }
      return temp;
  };
    </script>
</body>
</html>